package com.my.screenadapter.MPerMission;

import android.annotation.TargetApi;
import android.os.Build;

import androidx.fragment.app.Fragment;

/**
 * Created by 张英杰 on 2016/11/15.
 */

public class PackingPermission {
    public static void needPermission(Fragment fragment, int requestCode, String[] permissions){
        requestPermissions(fragment, requestCode, permissions);
    }
    @TargetApi(value = Build.VERSION_CODES.M)
    private static void requestPermissions(Object object, int requestCode, String[] permissions)
    {
//        if (!Utils.isOverMarshmallow())
//        {
//            doExecuteSuccess(object, requestCode);
//            return;
//        }
//        List<String> deniedPermissions = Utils.findDeniedPermissions(getActivity(object), permissions);
//
//        if (deniedPermissions.size() > 0)
//        {
//            if (object instanceof Activity)
//            {
//                ((Activity) object).requestPermissions(deniedPermissions.toArray(new String[deniedPermissions.size()]), requestCode);
//            } else if (object instanceof Fragment)
//            {
//                ((Fragment) object).requestPermissions(deniedPermissions.toArray(new String[deniedPermissions.size()]), requestCode);
//            } else
//            {
//                throw new IllegalArgumentException(object.getClass().getName() + " is not supported");
//            }
//
//        } else
//        {
//            doExecuteSuccess(object, requestCode);
//        }
    }
}
